{extend name="default/base/base_home" /}
{block name="mall_main"}
<script src="{$Think.PLUGINS_SITE_ROOT}/jquery.validate.min.js"></script>
<div class="page_register clearfix">
    <div class="w1200">
        <div class="r_icon1"></div>
        <div class="r_icon2"></div>
        <div class="r_icon3"></div>
        <div class="r_icon4"></div>
        <div class="r_icon5"></div>
        <form method="post" id="post_form" action="{:url('Connectsms/find_password')}" onsubmit="ajaxpost('post_form', '', '', 'onerror');">
            <div class="register_form">
                <div class="mt">找回密码</div>
                <div class="item clearfix">
                    <div class="label">手机号</div>
                    <div class="item-text">
                        <input type="text" id="sms_mobile" name="sms_mobile" class="text" tabindex="1" placeholder="输入您已注册的手机号" maxlength="11"/>
                    </div>
                </div>
                <div class="item clearfix">
                    <div class="label">手机验证码</div>
                    <div class="item-text">
                        <input type="text" id="sms_captcha" name="sms_captcha" class="text" tabindex="1" placeholder="请输入手机验证码" maxlength="6"
                               style="width:120px;"/>
                        <a class="send_code" id="btn_sms_captcha" ds_type="3">获取验证码</a>
                    </div>
                </div>
                <div class="item clearfix">
                    <div class="label">设置密码</div>
                    <div class="item-text">
                        <input type="password" id="member_password" name="member_password" class="text" tabindex="1" placeholder="输入您修改的密码"/>
                    </div>
                </div>
                <div class="item">
                    <input type="submit" class="btn login-btn" value="确认重置"/>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript" src="{$Think.HOME_SITE_ROOT}/js/connect_sms.js"></script>
<script>
    $(function () {
        $("#post_form").validate({
            errorPlacement: function (error, element) {
                var error_td = element.parent('.item-text');
                error_td.append(error);
                element.parents('.item:first').addClass('error');
            },
            success: function (label) {
                label.parents('.item:first').removeClass('error').find('label').remove();
            },
            submitHandler: function (form) {
                ajaxpost('post_form', '', '', 'onerror');
            },
            rules: {
                sms_mobile: {
                    required: true,
                    rangelength: [11, 11],
                    digits: true
                },
                sms_captcha: {
                    required: true,
                    minlength: 6
                },
                member_password: {
                    required: true,
                    minlength: 6,
                    maxlength: 20
                }
            },
            messages: {
                sms_mobile: {
                    required: '<i class="fa fa-exclamation-circle"></i>请输入正确的手机号',
                    rangelength: '<i class="fa fa-exclamation-circle"></i>请输入正确的手机号',
                    digits: '<i class="fa fa-exclamation-circle"></i>请输入正确的手机号'
                },
                sms_captcha: {
                    required: '<i class="fa fa-exclamation-circle"></i>请输入六位短信动态码',
                    minlength: '<i class="fa fa-exclamation-circle"></i>请输入六位短信动态码'
                },
                member_password: {
                    required: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.login_register_input_password}',
                    minlength: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.login_register_password_range}',
                    maxlength: '<i class="fa fa-exclamation-circle"></i>{$Think.lang.login_register_password_range}'
                }
            }
        });
    });
</script>
{/block}